<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Robocup-denayer-project-a: read-only/trunk/source/muismove.cpp Bron Bestand</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Gegenereerd door Doxygen 1.7.1 -->
<script type="text/javascript">
function hasClass(ele,cls) {
  return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}

function addClass(ele,cls) {
  if (!this.hasClass(ele,cls)) ele.className += " "+cls;
}

function removeClass(ele,cls) {
  if (hasClass(ele,cls)) {
    var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
    ele.className=ele.className.replace(reg,' ');
  }
}

function toggleVisibility(linkObj) {
 var base = linkObj.getAttribute('id');
 var summary = document.getElementById(base + '-summary');
 var content = document.getElementById(base + '-content');
 var trigger = document.getElementById(base + '-trigger');
 if ( hasClass(linkObj,'closed') ) {
   summary.style.display = 'none';
   content.style.display = 'block';
   trigger.src = 'open.png';
   removeClass(linkObj,'closed');
   addClass(linkObj,'opened');
 } else if ( hasClass(linkObj,'opened') ) {
   summary.style.display = 'block';
   content.style.display = 'none';
   trigger.src = 'closed.png';
   removeClass(linkObj,'opened');
   addClass(linkObj,'closed');
 }
 return false;
}
</script>
<div class="navigation" id="top">
  <div class="tabs">
    <ul class="tablist">
      <li><a href="main.html"><span>Hoofd&nbsp;Pagina</span></a></li>
      <li><a href="annotated.html"><span>Klassen</span></a></li>
      <li class="current"><a href="files.html"><span>Bestanden</span></a></li>
    </ul>
  </div>
  <div class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&nbsp;Lijst</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>read-only/trunk/source/muismove.cpp</h1>  </div>
</div>
<div class="contents">
<a href="muismove_8cpp.html">Ga naar de documentatie van dit bestand.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00009"></a>00009 <span class="preprocessor">#include &quot;<a class="code" href="muismove_8h.html">muismove.h</a>&quot;</span>
<a name="l00010"></a>00010 
<a name="l00011"></a>00011 <span class="keyword">using namespace </span>std;
<a name="l00012"></a>00012 
<a name="l00013"></a><a class="code" href="class_muis_move.html#a0d1ebfefa229034b0bb03046b80c5c9b">00013</a> <a class="code" href="class_muis_move.html#a0d1ebfefa229034b0bb03046b80c5c9b">MuisMove:: MuisMove</a>(<span class="keywordtype">int</span> nx ,<span class="keywordtype">int</span> ny)
<a name="l00014"></a>00014 {
<a name="l00015"></a>00015         x = nx;
<a name="l00016"></a>00016         y = ny;
<a name="l00017"></a>00017 }
<a name="l00018"></a>00018 
<a name="l00019"></a><a class="code" href="class_muis_move.html#abd86f71e2febe6ee90c256eee34301b0">00019</a> <a class="code" href="class_muis_move.html#abd86f71e2febe6ee90c256eee34301b0">MuisMove:: ~MuisMove</a>(<span class="keywordtype">void</span>)
<a name="l00020"></a>00020 {
<a name="l00021"></a>00021         <span class="comment">//destruct</span>
<a name="l00022"></a>00022 }
<a name="l00023"></a>00023 
<a name="l00024"></a><a class="code" href="class_muis_move.html#ac48e1ea45c6a0d885bb18dcd76c00f54">00024</a> <span class="keywordtype">void</span> <a class="code" href="class_muis_move.html#ac48e1ea45c6a0d885bb18dcd76c00f54">MuisMove::addMove</a>(<span class="keywordtype">int</span> nx ,<span class="keywordtype">int</span> ny)
<a name="l00025"></a>00025 {
<a name="l00026"></a>00026         dx += nx; adx += abs(nx);
<a name="l00027"></a>00027         dy += ny; ady += abs(ny);
<a name="l00028"></a>00028         <span class="keywordflow">if</span>( adx &gt; <a class="code" href="muismove_8h.html#a2116ac3a395c90ec2986c3f1869b7921" title="Muis.">NAU</a> || ady &gt; <a class="code" href="muismove_8h.html#a2116ac3a395c90ec2986c3f1869b7921" title="Muis.">NAU</a> )
<a name="l00029"></a>00029         {
<a name="l00030"></a>00030                 weg += sqrt( pow(adx,2) + pow(ady,2) );
<a name="l00031"></a>00031                 y   += dy; dy = 0; ady = 0;
<a name="l00032"></a>00032                 x   += dx; dx = 0; adx = 0;
<a name="l00033"></a>00033         }
<a name="l00034"></a>00034 }
<a name="l00035"></a>00035 
<a name="l00036"></a><a class="code" href="class_muis_move.html#a815f0134e9b3501ed2952d029b6c1898">00036</a> <span class="keywordtype">int</span> <a class="code" href="class_muis_move.html#a815f0134e9b3501ed2952d029b6c1898">MuisMove::getX</a>(<span class="keywordtype">void</span>)
<a name="l00037"></a>00037 {
<a name="l00038"></a>00038         <span class="keywordflow">return</span> x+dx;
<a name="l00039"></a>00039 }
<a name="l00040"></a>00040 
<a name="l00041"></a><a class="code" href="class_muis_move.html#aaf9b41783d315875c8cfb28851506db8">00041</a> <span class="keywordtype">int</span> <a class="code" href="class_muis_move.html#aaf9b41783d315875c8cfb28851506db8">MuisMove::getY</a>(<span class="keywordtype">void</span>)
<a name="l00042"></a>00042 {
<a name="l00043"></a>00043         <span class="keywordflow">return</span> y+dy;
<a name="l00044"></a>00044 }
<a name="l00045"></a>00045 
<a name="l00046"></a><a class="code" href="class_muis_move.html#a76145ec3b640cd9ac36af77ed8bb3a46">00046</a> <span class="keywordtype">int</span> <a class="code" href="class_muis_move.html#a76145ec3b640cd9ac36af77ed8bb3a46">MuisMove::getAbs</a>(<span class="keywordtype">void</span>)<span class="comment">//dus tov 0,0</span>
<a name="l00047"></a>00047 {
<a name="l00048"></a>00048         <span class="keywordflow">return</span> sqrt( pow((x+dx),2) + pow((y+dy),2) );
<a name="l00049"></a>00049 }
<a name="l00050"></a>00050 
<a name="l00051"></a><a class="code" href="class_muis_move.html#afc60b48d03c7ef0482484b9c23851ce3">00051</a> <span class="keywordtype">int</span> <a class="code" href="class_muis_move.html#afc60b48d03c7ef0482484b9c23851ce3">MuisMove::getD</a>(<span class="keywordtype">void</span>)<span class="comment">//echt de afgelegde weg</span>
<a name="l00052"></a>00052 {
<a name="l00053"></a>00053         <span class="keywordflow">return</span> weg + sqrt( pow(adx,2) + pow (ady,2) );
<a name="l00054"></a>00054 }
<a name="l00055"></a>00055 
<a name="l00056"></a><a class="code" href="class_muis_move.html#a16f4c4e59ab689426638e3e2951e3f64">00056</a> <span class="keywordtype">void</span> <a class="code" href="class_muis_move.html#a16f4c4e59ab689426638e3e2951e3f64">MuisMove::reset</a>(<span class="keywordtype">void</span>){
<a name="l00057"></a>00057         x=0;y=0;weg=0;
<a name="l00058"></a>00058         dx=0;dy=0;
<a name="l00059"></a>00059         adx=0;ady=0;
<a name="l00060"></a>00060 }
<a name="l00061"></a>00061 
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Gegenereerd op Wo 30 Maa 2011 23:59:21 voor Robocup-denayer-project-a door&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
</body>
</html>
